import 'package:bruno/bruno.dart';
import 'package:common/common.dart';
import 'package:common/image/image_tools.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../miao_pond/pond_list/pond_sort_pop_widget.dart';
import 'message_gift_widget.dart';

/// @description:
/// @author
/// @date: 2025-02-17 20:42:46
class MessageListPage extends StatefulWidget {
  const MessageListPage({Key? key}) : super(key: key);

  @override
  State<MessageListPage> createState() => _MessageListPageState();
}

class _MessageListPageState extends State<MessageListPage> {
  GlobalKey sortKey = GlobalKey();

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        Image.asset('assets/app/images/auth/background_top_image.png'),
        Scaffold(
          backgroundColor: Colors.transparent,
          appBar: BrnAppBar(
            title: '消息',
            centerTitle: false,
            leading: const SizedBox(),
            actions: [
              Image.asset('assets/app/images/pond/pond_icon_all_read.png', width: 32).onTap(() {
                showGiftListWidget(context);
              }),
              Image.asset('assets/app/images/pond/pond_icon_sort.png', key: sortKey, width: 32).onTap(() {
                PondSortPopWidget.show(context, sortKey: sortKey, sortCheck: 0);
              }),
            ],
            backgroundColor: Colors.transparent,
          ),
          body: Column(
            children: [
              Expanded(
                child: ListView.builder(
                  itemBuilder: (BuildContext context, int index) {
                    return Container(
                      alignment: Alignment.center,
                      padding: const EdgeInsets.symmetric(horizontal: 16),
                      height: 70.h,
                      child: Row(
                        children: [
                          Stack(
                            children: [
                              ImageView(
                                  url:
                                      'https://img1.baidu.com/it/u=728383910,3448060628&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=800',
                                  width: 50.w,
                                  shape: BoxShape.circle,
                                  type: ImageViewType.avater),
                              Container(
                                decoration: BoxDecoration(
                                    color: const Color(0xFF37F756), borderRadius: BorderRadius.circular(4.5.r)),
                                height: 9,
                                width: 9,
                                margin: const EdgeInsets.only(top: 3, left: 5),
                              ),
                            ],
                          ),
                          Expanded(
                            child: Padding(
                              padding: const EdgeInsets.symmetric(horizontal: 12),
                              child: Column(
                                mainAxisAlignment: MainAxisAlignment.center,
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Row(
                                    children: [
                                      Text(
                                        '游飞来寺',
                                        style: TextStyle(
                                            color: Colors.black, fontSize: 16.sp, fontWeight: FontWeight.w600),
                                      ),
                                      Padding(
                                        padding: const EdgeInsets.symmetric(horizontal: 6.0),
                                        child: Image.asset('assets/app/images/pond/pond_icon_girl.png', width: 16.w),
                                      ),
                                      Padding(
                                        padding: const EdgeInsets.symmetric(horizontal: 6.0),
                                        child: Image.asset('assets/app/images/pond/pond_icon_vip.png', width: 34.w),
                                      ),
                                      Container(
                                        alignment: Alignment.center,
                                        padding: EdgeInsets.symmetric(horizontal: 7.w),
                                        margin: const EdgeInsets.symmetric(horizontal: 6.0),
                                        height: 16.h,
                                        decoration: BoxDecoration(
                                            color: const Color(0xFFEEEEEE), borderRadius: BorderRadius.circular(8.r)),
                                        child: Text("已禁言",
                                            style: TextStyle(fontSize: 10.sp, color: const Color(0xFF999999))),
                                      )
                                    ],
                                  ),
                                  Text(
                                    '马上做，做精彩',
                                    style: TextStyle(color: const Color(0xFF999999), fontSize: 14.sp),
                                  ),
                                ],
                              ),
                            ),
                          ),
                          Column(
                            mainAxisAlignment: MainAxisAlignment.center,
                            crossAxisAlignment: CrossAxisAlignment.end,
                            children: [
                              Container(
                                  alignment: Alignment.center,
                                  decoration: BoxDecoration(
                                      color: const Color(0xFFF74437), borderRadius: BorderRadius.circular(9.r)),
                                  height: 18.h,
                                  padding: const EdgeInsets.symmetric(horizontal: 5),
                                  child: Text("99+", style: TextStyle(fontSize: 11.sp, color: Colors.white))),
                              Text(
                                '今天 12:23',
                                style: TextStyle(color: const Color(0xFF999999), fontSize: 14.sp),
                              ),
                            ],
                          )
                        ],
                      ),
                    );
                  },
                  itemCount: 20,
                ),
              ),
            ],
          ),
        ),
      ],
    );
  }
}
